#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

#define A_MEGABYTE (1024 * 1024 )

int main()
{
	char *some_menory ;
	size_t size_to_allocate = A_MEGABYTE;
	int megs_obtained =0 ;
	while(megs_obtained < 512){
		some_menory = (char *) malloc(size_to_allocate);
		if(some_menory !=NULL)
		{
			megs_obtained++;
			sprint(some_menory,"hello world")
			printf("%s - now allocated %d Megabytes\n",some_menory);
		}else{
		exit(EXIT_FAILURE);
		}	
	}
	exit(EXIT_SUCCESS);
}
